package hut.game;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class MyCustomDialog extends Dialog {
	public final int ICON = R.drawable.icon;
	public final int CUP = R.drawable.cup;
	private String content;
	private int selectImage = 0;
	
	Button btnOk;
	TextView txtContent;
	ImageView img;
	public MyCustomDialog(Context context)
	{
		super(context);
	}
	
	public void KhoiTao(String content, int img ) {
		this.content = content;
		this.selectImage = img;
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.custom_dialog_winner);
		setTitle("Chinese Chess v1.0");
		img = (ImageView)findViewById(R.id.imgCup);
		if(selectImage != 0)
			img.setImageResource(CUP);
		else
			img.setImageResource(ICON);
		txtContent =(TextView)findViewById(R.id.txtContentWinner);
		txtContent.setText(content);
		btnOk = (Button)findViewById(R.id.okWinner);
		btnOk.setOnClickListener(new OKListener());
	}
	
	private class OKListener implements android.view.View.OnClickListener {
        @Override
        public void onClick(View v) {
            MyCustomDialog.this.dismiss();
        }
	}
}
